Extract package fetching logic into shared utility #130
+110
−82
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR extracts the logic for fetching and validating packages into a shared utility which can be used by any commands.
Previously this was implemented in two locations, with more on the way in #101 and #119. Repeating this logic is complicated and prone to errors due to the various scenarios and validation required to gather a list of build-tools-compatible packages to run a command against.
This change fixes a potential bug where the
ci
andinstall
commands would try to run against unexpected packages (e.g: plugins with apackage.json
but nosrc/entrypoints
). I am unsure whether this was intentional, as although an entrypoint is not required to runnpm install
, we enforce the entrypoint directory structure in our projects and use this to differentiate them from other packages that may exist in a workspace. I don't think the build tools should be concerned with packages that don't meet this criteria as the results could be unexpected.Before
After